<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:define name="title">
	<h:outputText value="#{lang.LIST_COLLABORATOR}" />
</ui:define>

<body>
	<ui:composition template="layout.xhtml">
		
		
		<ui:define name="menuBody">
			<ui:include src="adminMenu.xhtml"></ui:include>
		</ui:define>
		<ui:define name="newHeader">
		</ui:define>
		<ui:define name="contentHeader">
			
			<h:outputText value="#{lang.LIST_TOOL}" />
		</ui:define>
		<ui:define name="contentBody">
		
		
				<p:dataTable id="toolDataTable"
					value="#{toolsBean.tools}" var="item"
					rowStyleClass="data-grid-content" tableStyleClass="data-grid"
					sortBy="#{item.name}" paginator="true" rows="8">

					<p:column headerText="#{lang.NAME}" id="name" sortBy="#{item.name}">
						<h:outputText value="#{item.name}" />
					</p:column>
					
					<p:column headerText=" " style="width:100px">
						<h:form>
						<p:commandButton icon="ui-icon-edit"
							oncomplete="editT.show()" 
							process="@this"
							update=":editTool"
							>
						<f:setPropertyActionListener target="#{toolsBean.selectedTool}" value="#{item}"  ></f:setPropertyActionListener>
						</p:commandButton>
						
						<p:spacer width="5px"></p:spacer>
						<p:commandButton icon="ui-icon-delete"
							onclick="return confirm('#{lang.CONFIRM_DELETE_TOOL} ?');"
							action="#{toolsBean.deleteTool(item)}">
						</p:commandButton>
						</h:form>
					</p:column>
					
				</p:dataTable>
				
				<br />
				<br />
				
				<p:dialog id="editTool"  widgetVar="editT" header="#{lang.UPDATE_TOOL}"
				resizable="false" showEffect="clip" hideEffect="clip">
				<h:form>
	            <table cellpadding="0" cellspacing="12" border="0" width="500">
							
							<tr>
								<td class="auth-label" width="200"><h:outputText
										value="#{lang.NAME}" /></td>
								<td align="left"><p:inputText id="nameE" size="10"
										styleClass="fields"
										value="#{toolsBean.selectedTool.name}"
										required="true">
									</p:inputText> <h:message for="nameE" /></td>
							</tr>
							<tr>
								<td class="auth-label" width="200"><h:outputText
										value="#{lang.PROCESS_NAME}" /></td>
								<td align="left">
								<p:inputText id="processNameE" size="10"
										styleClass="fields"
										value="#{toolsBean.selectedTool.processName}"
										required="true">
									</p:inputText> <h:message for="processNameE" /></td>
							</tr>
							<tr>
								<td class="auth-label" width="200"><h:outputText
										value="#{lang.DOMAIN}" /></td>
								<td align="left"><p:selectOneMenu id="domainE"
										value="#{toolsBean.selectedTool.domain}">
										<f:selectItems value="#{domainBean.domainValues}" var="domain"
											itemValue="#{rule}" itemLabel="{lang[domain]}" />
									</p:selectOneMenu> <h:message for="domainE" /></td>
							</tr>
							<tr>
								<td colspan="2">
								<h:commandButton value="#{lang.SAVE}" action="#{toolsBean.updateTool}"
									></h:commandButton> <h:commandButton
										value="#{lang.CANCEL}" onclick="editTool.hide()"></h:commandButton></td>
							</tr>
						</table>
						</h:form>
		     	</p:dialog>
			<br />
			<br />
			<br />
			<br />

		</ui:define>

	</ui:composition>
</body>
</html>